package handler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;

import drh.bean.Collection;

public class CollectionResultSetHandler implements ResultSetHandler<List<Collection>> {

	@Override
	public List<Collection> handle(ResultSet rs) throws SQLException {
		List<Collection>list = new ArrayList<>();
		while(rs.next()) {
		Collection info = new Collection();
		info.setId(rs.getInt("id"));
		info.setProductid(rs.getInt("productid"));
		info.setUserid(rs.getInt("userid"));
		info.setTime(rs.getDate("time"));
		info.setIsdelete(rs.getInt("isdelete"));
		list.add(info);	
		}
		return list;
	}	
}
